//
//  ACEMyAdvisorViewController.m
//  ACE
//
//  Created by zhangtao on 2018/8/14.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACEMyAdvisorViewController.h"
#import "ACEMeChangePSDCell.h"
@interface ACEMyAdvisorViewController ()
@property(nonatomic,strong)UIImageView *headImgV;
@property(nonatomic,strong)UITextField *linkTF;//联系方式
@property(nonatomic,strong)UITextField *desTF;//描述
@property(nonatomic,strong)UITextField *linkUsTF;//联系我们
@end

@implementation ACEMyAdvisorViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"导师";
    self.tableView.backgroundColor = [UIColor whiteColor];
    [self.tableView registerNib:[UINib nibWithNibName:@"ACEMeChangePSDCell" bundle:nil] forCellReuseIdentifier:@"cell"];
}

-(void)submit{
    NSLog(@"提交");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return ACEWidth*3/5;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 100;
}


-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *foot = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 100)];
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(15, 50, tableView.frame.size.width-30, 50)];
    btn.layer.cornerRadius = 25;
    [btn setBackgroundColor:MAIN_COLOR()];
    [btn setTitle:@"确认" forState:UIControlStateNormal];
    [btn addTarget:self
            action:@selector(submit) forControlEvents:UIControlEventTouchUpInside];
    [foot addSubview:btn];
    return foot;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *head = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ACEWidth, ACEWidth*3/5)];
    _headImgV = [[UIImageView alloc]initWithFrame:CGRectMake(ACEWidth/2-30, ACEWidth*3/5/3, ACEWidth*3/5/3, ACEWidth*3/5/3)];
    _headImgV.layer.cornerRadius = ACEWidth*3/5/3/2;
    _headImgV.layer.masksToBounds = YES;
    [head addSubview:_headImgV];
    _headImgV.image = [UIImage imageNamed:@"我的icon选中"];
    return head;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *arr = @[@"联系方式",@"申请描述",@"联系我们"];
    ACEMeChangePSDCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.titleLab.text = arr[indexPath.row];
    if (indexPath.row == 0) {
        _linkTF = cell.TF;
    }else if (indexPath.row == 1){
        _desTF = cell.TF;
    }else if (indexPath.row == 2){
        _linkUsTF = cell.TF;
        cell.TF.text = @"1234-5678-1234";
        cell.TF.enabled = NO;
    }
    return cell;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
